if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_insertExportBill]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_insertExportBill]
GO
CREATE PROC sp_insertExportBill
	@cusID			int,
	@totalPrice		varchar(20),
	@discount		int,
	@orderID		int,
	@id				int output
AS
BEGIN
	DECLARE @date datetime
	SET @date=getDate()
	INSERT INTO ImportExportBills (CustomerID, TotalPrice, [Type], Discount, Date, LastUpdate, Status, OrderID)
		VALUES (@cusID, @totalPrice, 'Export', @discount, @date, @date, 0, @orderID)
	SELECT @id=ID FROM ImportExportBills WHERE LastUpdate = @date
END